package AST;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Suite {
	private List<Stmt> stmtList= new ArrayList<Stmt>();
	private SimpleStmt simpleStmt;

	public Suite(List<Stmt> stmtList) {
		print();
		this.stmtList = stmtList;
	}

	public Suite() {
		print();
	}

	public List<Stmt> getStmtList() {
		return stmtList;
	}

	public void setStmtList(List<Stmt> stmtList) {
		this.stmtList = stmtList;
	}

	public void print() {
		System.out.println("Suite");
	}

	public SimpleStmt getSimpleStmt() {
		return simpleStmt;
	}

	public void setSimpleStmt(SimpleStmt simpleStmt) {
		this.simpleStmt = simpleStmt;
	}

	public void addStmtList(Stmt st) {
		this.stmtList.add(st);
	}

	public void genC(PW pw) {
		// suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
		Iterator<Stmt> itStmt = stmtList.iterator();

		if (simpleStmt != null) {
			simpleStmt.genC(pw);
		} else {
			pw.print("\n");
			pw.print("{");
			pw.print("\n");
			pw.add();
			while (itStmt.hasNext())
				itStmt.next().genC(pw);
			pw.sub();
			pw.print("}");
			pw.print("\n");
		}

	}
}
